@istest(SeeAllData=true)
public class Test_DNC_Lead {

    public static testMethod void testLeadmethod(){
    test.starttest();
        Schema.DescribeSObjectResult d = Schema.SObjectType.Lead;
    Map<String,Schema.RecordTypeInfo> rtMapByName = d.getRecordTypeInfosByName();
    Schema.RecordTypeInfo rtByName =  rtMapByName.get('West - Prospective Student');
    String RecTypeId  = rtByName.getRecordTypeId();
        Country__C co = new Country__c(Country_Code_2__c='23',Active__c=true,Economic_Grouping__c='HJJ',Language_Code__C='33');
        insert co;
        List<Lead> lst_Lead = new List<Lead>();
        Lead l=new Lead();
        l.email='john@john.com';
        l.firstname='John';
        l.Country_of_Birth__c =co.id;
        l.RecordTypeId=RecTypeId  ;
        l.Home_Phone__c ='78676-2';
        l.MobilePhone = '878-3444';
        l.Marketing_Phone__c='7732-22323';
        l.Other_Phone__c='66555';
        l.Other_Phone_2__c='32323'; 
        l.Mother_s_Phone_Number__c='32323323';
        l.Father_s_Phone_Number__c ='33232-33'; 
        l.HasOptedOutOfEmail=false;
        l.lastname='Coppedge';
        l.Personal_Email__c='john@john.com';
        l.Other_Email__c='john@john.com';
        l.Other_Email_2__c='john@2john.com';
        l.status='Appointment';
        l.street='test';
        l.state='CA';
        l.city='santa clara';
        l.postalcode='95051';
        l.country='USA';
        l.Country_of_Residence__c =Co.id;
        l.Country_of_Birth_Text__c='Mexico';
        l.Country_of_Residence_Text__c='Mexico';        
        l.Home_Phone_Preferences__c ='DNC';
        l.Mobile_Phone_Preferences__c = 'DNC';
        l.Work_Phone_Preferences__c = 'DNC';
        l.Mother_s_Phone_Preferences__c = 'DNC';
        l.Father_s_Phone_Preferences__c = 'DNC';
        l.Marketing_Phone_Preferences__c = 'DNC';
        l.Other_Phone_Preferences__c = 'DNC';
        l.Other_Phone_2_Preferences__c = 'DNC';     
        l.Other_Email_2_Preferences__c='Opt out';
        l.Other_Email_Preferences__c='Opt out';
        l.Marketing_Email_Preferences__c='Opt out';
        l.Father_s_Email_Preferences__c='Opt out';
        l.Mother_s_Email_Preferences__c='Opt out';
        l.University_Email_Preferences__c='Opt out';
        l.Work_Email_Preferences__c='Opt out';
        l.Personal_Email_Preferences__c='Opt out';  
        l.Work_Phone__c='(801) 555-5556';
    Lead ll=new Lead();
        ll.email='john@john.com';
        ll.firstname='John';
        ll.Country_of_Birth__c =co.id;
        ll.Home_Phone__c ='78676-2';
        ll.MobilePhone = '878-3444';
        ll.Marketing_Phone__c='7732-22323';
        ll.Other_Phone__c='66555';
        ll.RecordTypeId=RecTypeId  ;
        ll.Other_Phone_2__c='32323'; 
        ll.Mother_s_Phone_Number__c='32323323';
        ll.Father_s_Phone_Number__c ='33232-33'; 
        ll.HasOptedOutOfEmail=false;
        ll.lastname='Coppedge';
        ll.Personal_Email__c='john@john.com';
        ll.Other_Email__c='john@john.com';
        ll.Other_Email_2__c='john@3john.com';
        ll.status='Appointment';
        ll.street='test';
        ll.state='CA';
        ll.city='santa clara';
        ll.postalcode='95051';
        ll.country='USA';
        ll.Country_of_Residence__c =Co.id;
        ll.Country_of_Birth_Text__c='Mexico';
        ll.Country_of_Residence_Text__c='Mexico';
        lst_Lead.add(l);
        lst_Lead.add(ll);
        Insert lst_Lead;        
        try
        {
            Lead ld = [ Select id, Other_Email_2__c,Personal_Email_Preferences__c,Work_Email_Preferences__c,University_Email_Preferences__c,Mother_s_Email_Preferences__c,Father_s_Email_Preferences__c,Marketing_Email_Preferences__c,Other_Email_Preferences__c,Other_Email_2_Preferences__c,Other_Phone_2_Preferences__c ,Other_Phone_Preferences__c ,Marketing_Phone_Preferences__c ,Father_s_Phone_Preferences__c ,Mother_s_Phone_Preferences__c ,Mobile_Phone_Preferences__c ,Work_Phone_Preferences__c ,Home_Phone_Preferences__c ,Personal_Email__c,Other_Email__c from Lead where Other_Email_2__c='john@3john.com'];
            ld.Home_Phone_Preferences__c ='Opt out';
            
            ld.Mobile_Phone_Preferences__c = 'Opt out';
            ld.Work_Phone_Preferences__c = 'Opt out';
            ld.Mother_s_Phone_Preferences__c = 'Opt out';
            ld.Father_s_Phone_Preferences__c = 'Opt out';
            ld.Marketing_Phone_Preferences__c = 'Opt out';
            ld.Other_Phone_Preferences__c = 'Opt out';
            ld.Other_Phone_2_Preferences__c = 'Opt out';
            ld.Other_Email_2_Preferences__c='Opt out';
            ld.Other_Email_Preferences__c='Opt out';
            ld.Marketing_Email_Preferences__c='Opt out';
            ld.Father_s_Email_Preferences__c='Opt out';
            ld.Mother_s_Email_Preferences__c='Opt out';
            ld.University_Email_Preferences__c='Opt out';
            ld.Work_Email_Preferences__c='Opt out';
            ld.Personal_Email_Preferences__c='Opt out';
            update ld;
            
        }
        catch(Exception ex){}
        try
        {
            Lead ld = [ Select id, Other_Email_2__c,Personal_Email_Preferences__c,Work_Email_Preferences__c,University_Email_Preferences__c,Mother_s_Email_Preferences__c,Father_s_Email_Preferences__c,Marketing_Email_Preferences__c,Other_Email_Preferences__c,Other_Email_2_Preferences__c,Other_Phone_2_Preferences__c ,Other_Phone_Preferences__c ,Marketing_Phone_Preferences__c ,Father_s_Phone_Preferences__c ,Mother_s_Phone_Preferences__c ,Mobile_Phone_Preferences__c ,Work_Phone_Preferences__c ,Home_Phone_Preferences__c ,Personal_Email__c,Other_Email__c from Lead where Other_Email_2__c='john@2john.com'];
            l.Home_Phone_Preferences__c ='';
            l.Mobile_Phone_Preferences__c = '';
            l.Work_Phone_Preferences__c = '';
            l.Mother_s_Phone_Preferences__c = '';
            l.Father_s_Phone_Preferences__c = '';
            l.Marketing_Phone_Preferences__c = '';
            l.Other_Phone_Preferences__c = '';
            l.Other_Phone_2_Preferences__c = '';
            l.Other_Email_2_Preferences__c='';
            l.Other_Email_Preferences__c='';
            l.Marketing_Email_Preferences__c='';
            l.Father_s_Email_Preferences__c='';
            l.Mother_s_Email_Preferences__c='';
            l.University_Email_Preferences__c='';
            l.Work_Email_Preferences__c='';
            l.Personal_Email_Preferences__c='';
            update ld;
            
        }
        catch(Exception ex){}
        
     test.stoptest();   
    }
     static testMethod void AccountTest() {
    // here we test the new account master
    Account Acc = new Account();
    acc.LastName = 'Test';
    acc.FirstName = 'Unit';
    Acc.recordtypeId = Schema.Sobjecttype.Account.getRecordTypeInfosByName().get('West - Student Account').getRecordTypeId();
    Acc.Work_Phone__pc='3434';
    Acc.PersonHomePhone='3233232';
    Acc.PersonMobilePhone='232323';
    Acc.Marketing_Phone__pc='32323';
    Acc.Other_Phone_2__pc='32323';
    Acc.PersonOtherPhone='3232323';
    Acc.Mother_s_Phone__pc='3232323';
    Acc.Father_s_Phone__pc='23232323';
    insert Acc;
    }
    public static testMethod void testLeadmethod2(){
    test.starttest();
    
            Country__C co = new Country__c(Country_Code_2__c='23',Active__c=true,Economic_Grouping__c='HJJ',Language_Code__C='33');
            insert co;
            Lead l=new Lead();
            l.email='john@john.com';
            l.firstname='John';
            l.Country_of_Birth__c =co.id;
            l.Home_Phone__c ='78676-2';
            l.MobilePhone = '878-3444';
            l.Marketing_Phone__c='7732-22323';
            l.Other_Phone__c='66555';
            l.Other_Phone_2__c='32323'; 
            l.Mother_s_Phone_Number__c='32323323';
            l.Father_s_Phone_Number__c ='33232-33'; 
            l.HasOptedOutOfEmail=false;
            l.lastname='Coppedge';
            l.Personal_Email__c='john@john.com';
            l.Other_Email__c='john@john.com';
            l.Other_Email_2__c='john@2john.com';
            l.status='Appointment';
            l.street='test';
            l.state='CA';
            l.city='santa clara';
            l.postalcode='95051';
            l.country='USA';
            l.Country_of_Residence__c =Co.id;
            l.Country_of_Birth_Text__c='Mexico';
            l.Country_of_Residence_Text__c='Mexico';
       
            l.Mobile_Phone_Preferences__c = 'DNC';
            l.Work_Phone_Preferences__c = 'DNC';
            l.Mother_s_Phone_Preferences__c = 'DNC';
            l.Father_s_Phone_Preferences__c = 'DNC';
            l.Marketing_Phone_Preferences__c = 'DNC';
            l.Other_Phone_Preferences__c = 'DNC';
            l.Other_Phone_2_Preferences__c = 'DNC';
            l.Work_Phone__c='(801) 555-5556';
            
            insert l;
            
            Lead ld = [ Select id, Home_Phone__c ,Other_Email_2__c,Personal_Email__c,Other_Email__c from Lead where Other_Email_2__c='john@2john.com'];
            ld.Home_Phone__c='332232';
            ld.Personal_Email__c='john2@john.com';
            ld.Other_Email__c='john2@john.com';
            ld.Other_Email_2__c='john2@2john.com';
            update ld;
    
         test.stoptest();   
        }
        public static testMethod void AccountTest2() {
        // here we test the new account master
        Account Acc = new Account();
        acc.LastName = 'Test';
        acc.FirstName = 'Unit';
        Acc.recordtypeId=Schema.Sobjecttype.Account.getRecordTypeInfosByName().get('West - Student Account').getRecordTypeId();
        Acc.Work_Phone__pc='3434';
        Acc.PersonHomePhone='3233232';
        Acc.PersonMobilePhone='232323';
        Acc.Marketing_Phone__pc='32323';
        Acc.Other_Phone_2__pc='32323';
        Acc.PersonOtherPhone='3232323';
        Acc.Mother_s_Phone__pc='3232323';
        Acc.Father_s_Phone__pc='23232323';
        
        insert Acc;        
        
    }      
   
}